#自动获取当前日期
dateformat=$(date +%Y-%m-%d)
timeformat=$(date +%H:%M:%S)

rimraf dist

# 回到本地仓库，先删除名为origin的远程分支：
git remote rm origin
git remote rm GitHub
git remote rm Gitee

git add -A

# 获取命令行的第一个参数作为提交信息
git commit -m "$1"

# 添加多个远程仓库
git remote add GitHub  https://github.com/lakei-edward/vue-webpack.git
git remote add Gitee  https://gitee.com/lakeiedward/vue-webpack.git

# 上传到仓库主分支
git push GitHub master
git push Gitee master
if [$2]
then
    # 打包
    npm run build
    
    # 生成日志功能
    echo "$dateformat $timeformat" >> dist/log.txt
    echo "$1" >> dist/log.txt
    
    # 上传到服务器
    scp -r dist/* root@43.142.176.173:/usr/local/nginx/html/webpack/
fi